package edu.uniquindio.prmaven.proyectofinal;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;

import edu.uniquindio.prmaven.constants.ConfigurationConstants;
import edu.uniquindio.prmaven.constants.DataProvidersConstants;
import edu.uniquindio.prmaven.dataprovider.DataProviderArguments;
import edu.uniquindio.prmaven.general.TestCore;

public class CampoBlur extends TestCore {

	
	@Test()
	/**
	dataProviderClass = edu.uniquindio.prmaven.dataprovider.DataProviderFactory.class, 
	dataProvider = ConfigurationConstants.DP_FACTORY
	@DataProviderArguments(ConfigurationConstants.ESCENARIO
			+ ConfigurationConstants.EQUALS + DataProvidersConstants.HOJA_2)
			**/
	
	public void testCampoBlur()throws Exception {
		
		try{
			
		selenium.open("/showcase/");
		
		//selenium.click("css=span.MainLinkText"); Seleccionar menu Ajax Core
		WebElement menu=driver.findElement(By.cssSelector("span.MainLinkText"));
		menu.click();
		
		//selenium.click("link=• Event"); Seleccionar Submenu Event
		WebElement botonEvent=driver.findElement(By.xpath(("//*[@id='MENUSIDEindent']/div[2]/a[2]")));
		botonEvent.click();
		
		selenium.waitForPageToLoad("30000");
		
		//selenium.type("id=j_idt87:surname", "aasdjh3444@@@@"); Ingresar cadena al campo blur
		WebElement ingresarTex=driver.findElement(By.id("j_idt87:surname"));
		ingresarTex.sendKeys("aasdjh3444@@@@");
		
		selenium.waitForPageToLoad("10000");
		
		//Dar click fuera del campo Blur
		WebElement afuera=driver.findElement(By.xpath("//*[@id='CONTENTSIDEindent']/div[3]"));
		afuera.click();
		
		//Verificar cadena ingresada
		Assert.assertEquals(selenium.getText("id=j_idt87:out2"), "aasdjh3444@@@@");
		
		selenium.waitForPageToLoad("5000");	
		
		}catch(AssertionError e){
			System.out.println("no se encontro texto");
		}finally{
			
		}
	}

}
